class Solution {
public:
    bool isSymmetrical(TreeNode* pRoot) {
        if(pRoot == nullptr)
            return true;

        return helper(pRoot->left, pRoot->right);
    }

    bool helper(TreeNode* left ,TreeNode* right)
    {
        if(!left && !right)
            return true;
        if(!left || !right)
            return false;

        bool condition1 = left->val == right->val;
        bool condition2 = helper(left->left, right->right);
        bool condition3 = helper(left->right, right->left);

        return condition1 && condition2 && condition3;        
    }
};



struct myPair
{
    int count;
    int pos;
};

class Solution {
public:
    int FirstNotRepeatingChar(string str) {
        int ret = INT_MAX;

        map<char, myPair> map;
        for(int i = 0; i < str.size(); ++i)
        {
            map[str[i]].count++;
            map[str[i]].pos = i;
        }

        for(auto [ch, pair] : map)
        {
            if(pair.count == 1)
            {
                ret = min(ret, pair.pos);
            }
        }

        return ret == INT_MAX ? -1 : ret;
    }
};